<template>
  <div>
    <hr />
    <h1>Home：{{ $store.state.counter }}</h1>
    <button @click="incrementAction">+1</button>
    <button @click="decrementAction">-1</button>
  </div>
</template>
<script>
import { onMounted } from "vue";
import { useStore } from "vuex";
export default {
  setup() {
    const store = useStore();

    onMounted(() => {
      //在组建中想要知道派发出去的事件有没有完成，需要让当前的actions有返回值
      const promi = store.dispatch("getHomeBanner");
      promi
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    });
  },
};
</script>
<style>
</style>
